#pragma once
#include <string>
#include <unordered_map>

namespace http_util {
namespace mime_stat{

/* ----------------------------------------------------------
 * MIME Types (来自 IANA Media Types Registry 的常用子集)
 * ---------------------------------------------------------- */
inline const std::unordered_map<std::string, std::string> mime_types = {
    // Text
    {".html", "text/html; charset=utf-8"},
    {".htm", "text/html; charset=utf-8"},
    {".css", "text/css"},
    {".csv", "text/csv; charset=utf-8"},
    {".txt", "text/plain; charset=utf-8"},
    {".xml", "application/xml"},

    // JS / JSON
    {".js", "application/javascript"},
    {".mjs", "application/javascript"},
    {".json", "application/json"},

    // Images
    {".png", "image/png"},
    {".jpg", "image/jpeg"},
    {".jpeg", "image/jpeg"},
    {".gif", "image/gif"},
    {".svg", "image/svg+xml"},
    {".ico", "image/x-icon"},
    {".webp", "image/webp"},
    {".bmp", "image/bmp"},

    // Audio / Video
    {".mp3", "audio/mpeg"},
    {".wav", "audio/wav"},
    {".ogg", "audio/ogg"},
    {".mp4", "video/mp4"},
    {".webm", "video/webm"},

    // Fonts
    {".woff", "font/woff"},
    {".woff2", "font/woff2"},
    {".ttf", "font/ttf"},
    {".otf", "font/otf"},

    // Archives & Binary Files
    {".pdf", "application/pdf"},
    {".zip", "application/zip"},
    {".gz", "application/gzip"},
    {".tar", "application/x-tar"},
    {".7z", "application/x-7z-compressed"},

    // Default Fallback（没有匹配到时）
    // 注意：unordered_map 没办法给默认值，
    // 使用时需要手动判断 find == end()
};

/* ----------------------------------------------------------
 * HTTP Status Code → Description
 * 来自 RFC 9110 的标准状态码常用子集
 * ---------------------------------------------------------- */
inline const std::unordered_map<int, std::string> status_desc = {
    // 2xx Success
    {200, "OK"},
    {201, "Created"},
    {202, "Accepted"},
    {204, "No Content"},

    // 3xx Redirect
    {301, "Moved Permanently"},
    {302, "Found"},
    {304, "Not Modified"},

    // 4xx Client Error
    {400, "Bad Request"},
    {401, "Unauthorized"},
    {403, "Forbidden"},
    {404, "Not Found"},
    {405, "Method Not Allowed"},
    {408, "Request Timeout"},
    {413, "Payload Too Large"},
    {414, "URI Too Long"},

    // 5xx Server Error
    {500, "Internal Server Error"},
    {501, "Not Implemented"},
    {502, "Bad Gateway"},
    {503, "Service Unavailable"},
    {504, "Gateway Timeout"},
};
}//ns mime_stat
}//ns http_util